﻿package com.sstock.smartstock;

import android.content.Context;
import android.net.ConnectivityManager;
import android.os.Handler;
import android.os.Messenger;

public class Globals {

	//public static volatile boolean isWaitHandShaking = false;
	public static volatile boolean isServiceRunning = false;
	public static Messenger uiMessager;
	public static Messenger dataHandler;
	//global intent names
	public static final String UI_HANDLER_NAME = "uihandler";
	 
	public static final String UINAME_ADD_CODE = "code";
	public static final String UINAME_ALARM_UPBOUND = "upbound";
	public static final String UINAME_ALARM_UPBOUNDVALID = "upbound_valid";
	public static final String UINAME_ALARM_BOBOUND = "bobound";
	public static final String UINAME_ALARM_BOBOUNDVALID = "bobound_valid";
	public static final String UINAME_NOTES = "notes";
	public static final String UINAME_UPBOUND_UNIT = "up_boundunit";
	public static final String UINAME_BOBOUND_UNIT = "bo_boundunit";
	public static final String UINAME_ALARMINTENT_CODE = "alarm_code";
	public static final String UINAME_ALARMINTENT_PRICE = "alarm_price";
	public static final String UINAME_ALARMINTENT_CURRENT = "alarm_current";
	public static final String UINAME_ALARMINTENT_FLAG = "alarm_flag";
	public static final String UINAME_LISTDATE = "list_date";
	public static final String UINAME_SIMCODE = "sim_code";
	public static final String UINAME_SIMPRICE = "sim_price";
	public static final String UINAME_SIMNUMBER = "sim_number";

	//ui message id
	public static final int UIMESSEAGE_CONNECT_OK = 1;
	//(String,UINAME_LISTDATE)  the listdate format is yyyy-mm-dd, but may be ""
	public static final int UIMESSEAGE_RANDOM_RECEIVED = 2;
	public static final int UIMESSAGE_STOCK_ALARM = 3; 
	/*used to start the Stock Alarm Activity
	 *(String,UINAME_ADD_CODE) (String UINAME_ALARM_UPBOUND,String UINAME_ALARM_BOBOUND,String UINAME_UPBOUND_UNIT,String UINAME_BOBOUND_UNIT,
	 *boolean UINAME_ALARM_UPBOUNDVALID, boolean UINAME_ALARM_BOBOUNDVALID)
	 */
	public static final int UIMESSAGE_SIMULATE_TRADE = 4; //used to start the Simulate trade of the selected stock
	
	
	public static final int UIMESSAGE_ADD_SELECT = 6;
	// add a self-select stock: (String UINAME_ADD_CODE)
	public static final int UIMESSAGE_DELETE_SELECT = 7;
	// delete a self-select stock: (String UINAME_ADD_CODE)
	public static final int UIMESSAGE_REFRESH_STOCKDB = 8;
	// inform that need refresh the stock database
	public static final int UIMESSAGE_ADD_NOTES = 9;
	// add notes: (String UINAME_ADD_CODE, String UINAME_NOTES)
	public static final int UIMESSAGE_SEARCH_CODE = 10;
	// add stock: (String UINAME_ADD_CODE)；	
	public static final int UIMESSAGE_QUIT = 11;

	

	//data message id
	public static final int STOCK_REFRESH_MSG      = 1;
	/*
	 * Refresh Message contain:
	 * stock code    like 600123
	 * stock name    like 兰花科创
	 * stock price   like 43.25
	 * stock percent like +/- 0.01% 
	 */
	public static final int STOCK_DATABASE_MSG     = 2;
	/*-------------------------------------------------------
	 * 兰花科创                    43.25|          +0.01%|
	 * 600123		  	   |				|
	 --------------------------------------------------------
	       广电电子		   6.02|         +10.00%|
	   600602
	 --------------------------------------------------------
	 */
	public static final int STOCK_DELETE_MSG      = 3;    //stock delete message and save the deleted stock  in the ONCE concerted 
	public static final int STOCK_ALARM_MSG       = 4;	  //stock alarm message	and refresh the selected stock data list
	public static final int STOCK_SAVE_REMARK	  = 5;    //save the remark of the selected stock and refresh the UI
	public static final int STOCK_SIMULATE_TRADE  = 6;	  //save the simulate trade data in the database and refresh the UI
	public static final int STOCK_ADD_NEW         = 7;    //save the added stock to database and refresh the UI 
	public static final int STOCK_SEARCH_LIST     = 8;	  //return all stock searched list.
	public static final int STOCK_EXIST_MSG       = 9;    //stock already exist in the self selected list
	
	public static final int STOCK_NEED_FRESH  	  = 15;
	public static final int CAN_NOT_CONNECT_INTERNET = 16;
	public static final int STOCK_NEED_ANALYZE      = 17;
	public static final int STOCK_NEED_ALARM        = 18;
	public static final int STOCK_FIRST_FRESH       = 19;
	public static final int RANDOM_NUM = 101;
	
	//server needed 
	public static final String SERVER = "http://hq.sinajs.cn/list=%s";
	
	//network connected mark
	public static boolean connectmark = false;
	
}
